import InteractiveBase from "../../../LevelCommon/InteractiveBase";
import LevelBaseControl from "../../../LevelCommon/LevelBaseControl";
import GasStove from "./GasStove";
import { GamePropData } from "../../../Data/GamePropData";

export default class GasButtonCheck extends InteractiveBase {
    /** 需要的道具id*/
    public needGamePropId: number;
    
    private levelControl: LevelBaseControl;
    /** 煤气灶*/
    private gasStove: GasStove;
    onStart() {
        this.levelControl = window.gameFacade.LevelMng.GetCurLevelControl();
        this.gasStove = this.owner.parent.getComponent(GasStove);
    }

    /** 煤气灶开关检测*/
    protected InteractiveLogic(): boolean {
        /** 检查有没有这个道具*/
        let curSelectProp: GamePropData = this.levelControl.CurSelectProp;
        /** 如果是需要的道具 就使用*/
        if (curSelectProp != null && curSelectProp.id == this.needGamePropId) {
            this.levelControl.UseCurProp();
            this.gasStove.PutGasButton();
        }
        return true;
    }
}